###################################################
README File for replications materials: 

Paper title: ''Re-stigmatizing the radical right: A one way street?,'' Journal of Experimental Political Science

Authors: Laia Balcells, Sergi Martínez, Vicente Valentim, and Ethan vanderWilden
Corresponding Author: Ethan vanderWilden (ethan.vanderwilden@wisc.edu)
Date: June 3, 2025

###################################################
Overview: 

This replication folder contains all necessary components to reproduce results from above titled paper. This README file include information on:
 - Description of Software Command Files (R scripts)
 - Description of "helper functions" loaded from "functionsBMVV.R"
 - Data and organization
 - Computing Environment
 
* When replicating the analysis, working directories may need to be changed to correctly locate data (SAV) files
* Tabular outputs appear in the R console environment
* Figure outputs appear in the 'plots' window of the R studio environment and can be saved from there (dimensions noted in code comments)

###################################################
Description of Software Command Files (R Scripts):

Our analysis can be performed with the file "analysisBMVV.R". The file has 4 sections: 

In Section 1, we load in the data (include a version of the data with and without 'incompletes'), and sources in "helper functions" from the file "functionsBMVV.R". The helper functions are used to minimize repeating code, especially where we perform similar analysis with slightly different model specifications (such as including/excluding control variables) or with slightly different data subsets (such as excluding some respondents who failed a post-treatment factual manipulation check).

In Section 2, we adjust variables and create indices for analysis. We flip "acceptability" measures such that high values indicate greater levels of stigma, and we create indices for 2nd order acceptability, 1st order sanctioning, and 2nd order sanctioning.

In Section 3, we include code to re-produce numerical results and Figures that appear in the main text.

In Section 4, we include code to re-produce Appendix sections A1-A9.

###################################################
Descriptions of "helper functions" loaded from "functionsBMVV.R"

Function A [validation_coefs()] takes in a dataset and returns regression coefficients & SE on the validation outcomes (second order perceptions of how different actors view the radical right). If you want to include control variables (here, age, gender, education, income, pol.know, SP.nationalism, CCAA.nationalism , and a regional FE), set "controls" to TRUE.

Function B [reg_coefs()] takes in a dataset and specific outcome variable name, and then returns regression coefficients & SE (including necessary corrections for multiple hypotheses). If you want to include control variables (here, age, gender, education, income, pol.know, SP.nationalism, CCAA.nationalism , and a regional FE), set "controls" to TRUE.

Function C [get_plot()] takes in a dataframe of regression coefficients (either from Function A or B) and returns a coefficient plot. The user can adjust the title of the plot (mytitle), whether the confidence intervals should reflect multiple hypothesis corrections (bh), the range of the X axis centered at 0 (range), and the length of interval between X axis labels (jump).

Function D [get_paired()] takes in a dataset and specific outcome variable name and returns a coefficient plot, where the coefficients reflect the differences in means between relevant treatment groups (to assess H2) on the specified outcome. The user can adjust the title of the plot (mytitle), the range of the X axis centered at 0 (range), and the length of interval between X axis labels (jump).



###################################################
Data and organization: 

The main analysis is done with an original dataset collected by the authors, titled called "dataBMVV.sav". We also include the datafile that includes "incomplete" data (mostly those screened by the first factual manipulation check), called "df_incompletesBMVV.sav". On line 32 of the R script, we show the command that can be used to create the final dataset from the dataset with incompletes. We retain the dataset with incompletes to allow for a proper treatment and discussion of attrition in Section 4 - A.3.

The variables and coding for the dataset is included in the codebook file: "codebookBMVV.pdf".

###################################################
Computing Environment:

 - Analyses were run using R version 4.4.1
 - Analyses were primarily built with Windows version 11 (using an AMD Ryzen 5 5500U processor with a 64-bit operating system) and replicated in an R environment using MacOS version 12.6
 - Code to install and load relevant R packages are included in the ''analysisBMVV.R'' file. Packages include: "tidyverse" (version 2.0.0), "patchwork" (version 1.2.0), "haven" (version 2.5.4), "modelsummary" (version 2.1.1), "Hmisc" (version 5.1-3), "collapse" (version 2.0.15), "attritevis" (version 0.1.0), "factoextra" (version1.0.7), "kableExtra" (version 1.4.0), and "ggridges" (version 0.5.6).

###################################################

